// pages/poem.js
var qcloud = require('../../vendor/wafer2-client-sdk/index')
var config = require('../../config')
var util = require('../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    scrollHeight: 0,
    poetry: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const that = this
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          scrollHeight: res.windowHeight
        });
      }
    });
    this.loadPoetries(options.id)
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  loadPoetries: function (id) {
    const that = this;
    that.setData({
      loadding: true,
    })
    wx.request({
      url: config.service.apiUrl + '/poetries/' + id,
      success: function (res) {
        that.setData({
          poetry: res.data,
          loadding: false,
        });
      }
    })
  }
})